package config

type AppConfig struct {
	*AppDetailConfig `mapstructure:"app"`
	*LogConfig       `mapstructure:"log"`
	*OssConfig       `mapstructure:"minio"`
	*CloudMqtt       `mapstructure:"cloud_mqtt"`
	*LocalMqtt       `mapstructure:"local_mqtt"`
	*DbConfig        `mapstructure:"db"`
	*CacheConfig     `mapstructure:"cache"`
}

type AppDetailConfig struct {
	Name      string `mapstructure:"name"`
	Code      string `mapstructure:"code"`
	Mode      string `mapstructure:"mode"`
	Version   string `mapstructure:"version"`
	Port      int    `mapstructure:"port"`
	StartTime string `mapstructure:"start_time"`
	MachineID uint16 `mapstructure:"machine_id"`
}

type LogConfig struct {
	Level      string `mapstructure:"level"`
	Filename   string `mapstructure:"filename"`
	MaxSize    int    `mapstructure:"max_size"`
	MaxAge     int    `mapstructure:"max_age"`
	MaxBackUps int    `mapstructure:"max_backups"`
}

type OssConfig struct {
	Endpoint  string `mapstructure:"endpoint"`
	AccessKey string `mapstructure:"access_key"`
	SecretKey string `mapstructure:"secret_key"`
	UseSSL    bool   `mapstructure:"use_ssl"`
}

type CloudMqtt struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"Password"`
}

type LocalMqtt struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"Password"`
}

type DbConfig struct {
	DbType       string `mapstructure:"db_type"`
	DbPath       string `mapstructure:"db_path"`
	DbFile       string `mapstructure:"db_file"`
	Host         string `mapstructure:"host"`
	Username     string `mapstructure:"username"`
	Password     string `mapstructure:"password"`
	DBName       string `mapstructure:"dbname"`
	Port         int    `mapstructure:"port"`
	MaxOpenConns int    `mapstructure:"max_open_conns"`
	MaxIdleConns int    `mapstructure:"max_idle_conns"`
}

type CacheConfig struct {
	CacheTYPE string `mapstructure:"cache_type"`
	CachePath string `mapstructure:"cache_path"`
	CacheFile string `mapstructure:"cache_file"`
	Host      string `mapstructure:"host"`
	Password  string `mapstructure:"password"`
	Port      string `mapstructure:"port"`
	DB        int    `mapstructure:"db"`
	PoolSize  int    `mapstructure:"pool_size"`
}
